#!/bin/bash

# 检查http-server是否已安装
http_found=false

# 检查RPM系统 (RHEL/CentOS/Fedora)
if rpm -q http-server >/dev/null 2>&1; then
    http_found=true
fi

# 检查DEB系统 (Debian/Ubuntu)
if dpkg -l | grep -q 'http-server' 2>/dev/null; then
    http_found=true
fi

if [ "$http_found" = true ]; then
    echo "[-] 检测失败: http-server已安装"
    
    # 显示已安装的http-server相关包
    echo "    已安装的http-server相关包:"
    rpm -qa | grep http-server 2>/dev/null | sed 's/^/    /' || true
    dpkg -l | grep http-server 2>/dev/null | sed 's/^/    /' || true
    
    exit 1
else
    echo "[+] 检测通过: http-server未安装"
    exit 0
fi

